<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace plugins\zhl_system_info;

use cmf\lib\Plugin;
use think\Db;

class ZhlSystemInfoPlugin extends Plugin
{

    public $info = [
        'name'        => 'ZhlSystemInfo',
        'title'       => 'zhlblog系统信息',
        'description' => 'zhlblog系统信息',
        'status'      => 1,
        'author'      => 'ThinkCMF',
        'version'     => '1.0'
    ];

    public $hasAdmin = 0;//插件是否有后台管理界面

    // 插件安装
    public function install()
    {
        return true;//安装成功返回true，失败false
    }

    // 插件卸载
    public function uninstall()
    {
        return true;//卸载成功返回true，失败false
    }

	 public function adminDashboard()
    {

        $c_article = Db::name("portal_post")->where('post_type=1')->count();
        $c_page = Db::name("portal_post")->where('post_type=2')->count();
        $c_comment = Db::name("comment")->where('status=1')->count();
        $c_user = Db::name("user")->where('user_status=1 and user_type=2')->count();
		$this->assign('c_article', $c_article);
		$this->assign('c_page', $c_page);
		$this->assign('c_user', $c_user);
		$this->assign('c_comment', $c_comment);

        return [
            'width'  => 12,
            'view'   => $this->fetch('widget'),
            'plugin' => 'zhlSystemInfo'
        ];
    }
   

}